if (typeof XMLHttpRequest != 'undefined')
{
	var xmlHttpObject = new XMLHttpRequest();
}
else
{
	try
	{
		var xmlHttpObject = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			xmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e)
		{
			xmlHttpObject = false;
		}
	}
}

function AJAXh()
{
	if (xmlHttpObject)
	{
		all = document.getElementsByTagName("a");
		for (var i = 0; i < all.length; i++)
		{
			if (   all[i].getAttribute('onclick') != null
				&& all[i].getAttribute('onclick').substr(0,6) == "AJAXh(")
			{
				all[i].setAttribute(
									'onclick',
									"AJAXhHandle('"
									+ all[i].getAttribute("href") + "')"
				);
				all[i].removeAttribute('href');
			}
		}
	}
}


function AJAXhHandle(url)
{
	pos = (url.indexOf("?") != -1)? url.indexOf("?"): url.indexOf("#");
	if (pos == -1) pos = url.length;
	url = url.substring(0,pos) + ".ajax" + url.substring(pos, url.length);
		
	xmlHttpObject.open("GET", url, false);
	xmlHttpObject.send();

	if (window.DOMParser)
	{
		parser=new DOMParser();
		xmlDoc=parser.parseFromString(xmlHttpObject.responseText, "text/xml");
	}
	else // Internet Explorer
	{
		xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.async="false";
		xmlDoc.loadXML(xmlHttpObject.responseText);
	}
	xmlDoc = xmlDoc.firstChild;
	for (var i = 0; i < xmlDoc.childNodes.length; i++)
	{
		node = xmlDoc.childNodes[i].firstChild;
		switch (xmlDoc.childNodes[i].nodeName.toLowerCase())
		{
			case "replace":
				AJAXhReplace(node);
				break;
			case "append":
				AJAXhAppend(node);
				break;
		}
	}
}

function AJAXhReplace(node)
{
	while (node != null)
	{
		if (node.nodeType == 1)
		{
			for each (var o in AJAXhGet(node))
			{
				o.parentNode.replaceChild(node.firstChild, o);
				r = node.firstChild.nextSibling;
				while (r != null)
				{
					o.parentNode.insertBefore(r, o.nextSibling);
					r = r.nextSibling;
				}
			}
		}
		node = node.nextSibling;
	}
}

function AJAXhGet(node)
{
	if (node.attributes[0] == undefined)
	{
		return [document.getElementById(node.nodeName)];
	}
	
	switch (node.attributes[0].nodeValue.toLowerCase())
	{
		case "name":
			return document.getElementsByName(node.nodeName);
	}
}